﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Core;

namespace DAL
{
    public class ResorceInvateDAL : SyncBase<Model.ResorceInvate>
    {
        static ResorceInvateDAL()
        {
            StringBuilder strSql = new StringBuilder();
            ResorceInvateDAL.addSQL = @"insert into TempResorceInvate(
TeacherID,LessionID,FatherId,ResourceID,PageCode,FeedbackType,StudentId,StartTime,StartPiont,FeedContent,RecordTime)
 values (
@TeacherID,@LessionID,@FatherId,@ResourceID,@PageCode,@FeedbackType,@StudentId,@StartTime,@StartPiont,@FeedContent,@RecordTime)";
            ResorceInvateDAL.tbName = "TempResorceInvate";
            ResorceInvateDAL.remoteUrl = "/Ayyfford/AddResorceInvate";
            ResorceInvateDAL.setVal = (lt) =>
            {
                StringBuilder sb = new StringBuilder();
                string _ids = string.Empty;
                if (lt != null && lt.Count > 0)
                {
                    lt.ForEach(t =>
                    {
                        _ids += t.ID + ",";
                        sb.AppendFormat("({0}, {1}, {2}, {3}, {4}, {5}, {6},{7},{8},{9},{10}),",
                                        t.TeacherID, t.LessionID, t.FatherId.NullNumber(), t.ResourceID, t.PageCode.NullNumber(), t.FeedbackType, t.StudentId, t.StartTime.StringDate(), t.StartPiont.NullNumber(), t.FeedContent.NullString(), t.RecordTime.NullDate());
                    });
                }
                return new Tuple<string, string>(sb.ToString(), _ids);
            };
        }

        new public static void SaveEntity(Model.ResorceInvate t)
        {
            SyncBase<Model.ResorceInvate>.SaveEntity(t);
        }

        new public static void AsyncData()
        {
            SyncBase<Model.ResorceInvate>.AsyncData();
        }
    }
}
